#include <cstdio>

int max(int a, int b);
int list[26];
int dp[26];

int main(int argc, char const* argv[]) {
    int n;
    while (scanf("%d", &n) != EOF) {
        for (int i = 1; i <= n; i++)
            scanf("%d", &list[i]);
        for (int i = 1; i <= n; i++) {
            int temp_max = 1;
            for (int j = 1; j < i; j++) {
                if (list[j] >= list[i])
                    temp_max = max(temp_max, dp[j] + 1);
            }
            dp[i] = temp_max;
        }
        int result = 1;
        for (int i = 1; i <= n; i++)
            result = max(result, dp[i]);
        printf("%d\n", result);
    }
    return 0;
}

int max(int a, int b) {
    return a > b ? a : b;
}